<?php include('_init_.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/admin-body.css" rel="stylesheet" type="text/css" />
<link href="../css/admin-epaper.css" rel="stylesheet" type="text/css" />
<link href="../css/uploadifyb.css" rel="stylesheet" type="text/css" />
<link href="../css/jquery/smoothness/jquery-ui-1.10.2.custom.min.css" rel="stylesheet" type="text/css" />
<title>班尼頓寫真後台管理</title>
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../js/swfobject.js"></script>
<script type="text/javascript" src="../js/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.10.2.datepicker.min.js"></script>
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
  $('#file_upload1').uploadify({
    'uploader'  : 'uploadify.swf',
    'script'    : 'uploadify.php',
    'cancelImg' : 'cancel.png',
    'folder'    : '/uploads',
    'auto'      : true,
    'scriptData':{'<?php echo session_name();?>':'<?php echo session_id();?>','name':$(this).attr('name'),'responsetype':'filecontent'},
	'displayData': 'speed',
	'onComplete':function(event,queueID,fileObj,response,data){
		
		 $('textarea[name=email_address]').val(response);
	},
	'onError':function(event,queueId,fileObj,errorObj){
		alert(errorObj);
	}
  });
});

$(function(){
	$('.datepicker').datepicker({ dateFormat: "yy-mm-dd" });
	$('.ck_time').click(function(){
		   $('.ck_time').attr('checked',false);
		   $(this).attr('checked',true);
		      
		});
	$('input[name=send_email_address]').click(function(){
		var is_checked = $(this).attr('checked');
		 if ( is_checked ) {
			 $('textarea[name=email_address]').parent().parent().show();
		 }else{
			 $('textarea[name=email_address]').parent().parent().hide();
		 }
	});

	<?php if (strlen($GLOBALS['PAGE_FORM_DATA']['email_address']) > 0):?>
	$('textarea[name=email_address]').parent().parent().show();
	<?php endif;?>
});

function selected_epaper(epaper_id, epaper_subject)
{
	$('#label_selected_epaper_subject').text(epaper_subject);
	$('input[name=epaper_id]').val(epaper_id);
	rClose();
}
// ]]>
</script>
<script language="javascript" src="js/rAlertb.js"></script>
<script language="javascript">
function epaper(id) {
		rAlert("epaper-list.php" , null, " 電子報列表 ",600, 400);
}
function check_form()
{
	var form = document.forms['page_form'];
	if ( form.epaper_id.value == '' ) {
		alert('請選擇文章');
		return false;
	}
	if ( form.send_date.value == '' ) {
		alert('請選擇發送日期');
		return false;
	}
	if ( $('.ck_time:checked').length == 0 ) {
		alert('請選擇發送時間');
		return false;
	}
	form.submit();
	return false;
}
</script>
</head>

<body>
<?php include_once('admin-top.php');?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>" name="page_form"> 
<input type="hidden" name="id" value="<?php echo $GLOBALS['PAGE_FORM_DATA']['id'];?>"/>
<input type="hidden" name="act" value="save"/>
<input type="hidden" name="epaper_id" value="<?php echo  $GLOBALS['PAGE_FORM_DATA']['epaper_id'];?>"/>
<div id="main" class="clearfix"><!-- star #main //-->
  <?php include_once('sub-epaper.php');?>
  <div id="contactall"><!-- star #main //-->
  <div id="tit" ><!-- star #tit //-->
    <ul>
    <li class="tit-a"><?php echo  $GLOBALS['PAGE_FORM_DATA']['id'] > 0 ?'修改':'新增'; ?>發送設定</li>
    <li class="tit-b"> </li>
    </ul>
  </div><!-- end #tit //-->
  <div id="ContactEpaper" class="clearfix" ><!-- star #contactEdit //-->
  <ul>
    <li>選擇文章：<a href="#" onclick="javascript:epaper(1118);return false;">選擇</a>
    <span id="label_selected_epaper_subject"><?php echo  $GLOBALS['PAGE_FORM_DATA']['epaper_subject'];?></span></li>
   
    </ul>
  <ul>
    <li class="ce-1">
    <p>發送時間：</p>
    <p class="ce-3"><input name="send_date" type="text" class="ce-3a datepicker" value="<?php echo  $GLOBALS['PAGE_FORM_DATA']['send_date'];?>" /></p>
    <p><input name="send_time" type="checkbox" value="02:00:00" class="ck_time" <?php if ($GLOBALS['PAGE_FORM_DATA']['send_time'] == '02:00:00') echo "checked='checked'";?>/>&nbsp;AM 2:00</p>
    <p><input name="send_time" type="checkbox" value="04:00:00" class="ck_time" <?php if ($GLOBALS['PAGE_FORM_DATA']['send_time'] == '04:00:00') echo "checked='checked'";?>/>&nbsp;AM 4:00</p>
    <p><input name="send_time" type="checkbox" value="06:00:00" class="ck_time" <?php if ($GLOBALS['PAGE_FORM_DATA']['send_time'] == '06:00:00') echo "checked='checked'";?>/>&nbsp;AM 6:00</p>
    </li>
    </ul>
  <ul>
    <li class="ce-1">
    <p>發送名單：</p>
    <p><input name="send_member" type="checkbox" value="Y" <?php if ($GLOBALS['PAGE_FORM_DATA']['send_member'] == 'Y') echo "checked='checked'";?>/>&nbsp;網站會員</p>
    <p><input name="send_email_address" type="checkbox" value="Y" <?php if (strlen($GLOBALS['PAGE_FORM_DATA']['email_address']) > 0) echo "checked='checked'";?>/>&nbsp;匯入名單</p>
    </li>
    </ul>
    <ul>
    <li class="ce-2" style="height:auto;display:none;">
    <p>上傳名單：</p>
    <p><input id="file_upload1" type="file" name="file_upload" /><span>档案內容格式爲：user1@abc.com,user2@abc.com,user3@abc.com</span></p>
    <br/>
    <p style="clear:both;">
    <textarea name="email_address" cols="120" rows="12"><?php echo $GLOBALS['PAGE_FORM_DATA']['email_address'];?></textarea>
    </p>
    </li>
    </ul>
    <ul>
    <li class="ce-4"><a href="#" onclick="return check_form();">設定完成</a></li>
    </ul>

 
  </div><!-- end #contactEdit //-->
  
  </div><!-- end #contactall //-->
</div><!-- end #main //-->
</form>
</body>
</html>